package com.bus.boot.dao.assist.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.bus.boot.dao.assist.BusGuestbookCtgDao;
import com.bus.boot.entity.assist.BusGuestbookCtg;
import com.bus.common.hibernate4.Updater;
import com.bus.common.jpa.JpaBaseDao;

@Repository
public class BusGuestbookCtgDaoImpl extends
		JpaBaseDao<BusGuestbookCtg, Integer> implements
		BusGuestbookCtgDao {
	@SuppressWarnings("unchecked")
	public List<BusGuestbookCtg> getList(Integer siteId) {
		String hql = "from BusGuestbookCtg bean"
				+ " where bean.site.id=? order by bean.priority asc";
		return find(hql, siteId);
	}

	public BusGuestbookCtg findById(Integer id) {
		BusGuestbookCtg entity = get(id);
		return entity;
	}

	public BusGuestbookCtg save(BusGuestbookCtg bean) {
		getEntityManager().persist(bean);
		return bean;
	}

	public BusGuestbookCtg deleteById(Integer id) {
		BusGuestbookCtg entity = super.get(id);
		if (entity != null) {
			getEntityManager().remove(entity);
		}
		return entity;
	}

	@Override
	protected Class<BusGuestbookCtg> getEntityClass() {
		return BusGuestbookCtg.class;
	}

	@Override
	public BusGuestbookCtg updateByUpdater(Updater<BusGuestbookCtg> updater) {
		// TODO Auto-generated method stub
		return null;
	}
}